<<<<<<< HEAD
<!--
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-08 21:04:24
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 12:59:48
 * @FilePath: \vue 小U到家\src\views\Mainpeisongyuan.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-container>
    <el-header>
      关键字 :
      <el-input
        class="search"
        type="text"
        placeholder="请输入内容"
        @change="selects()"
        v-model="text"
      ></el-input>
      状态 :
      <el-select
        class="search"
        @input="selects()"
        v-model="peiSongYuanZhuangTai"
        placeholder="请选择"
      >
        <el-option
          v-for="item in peiSongYuanArr"
          :key="item.PSYvalue"
          :label="item.PSYlabel"
          :value="item.PSYvalue"
          size="mini"
        >
        </el-option>
      </el-select>
    </el-header>
    <!-- 弹出框 -->
    <el-dialog
      class="psyModle"
      title="添加配送员"
      :visible.sync="centerDialogVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXun">姓名 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入姓名"
        v-model="peisongyuanName"
      ></el-input>
      <span class="psChaXun">电话 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="peisongyuanPhone"
      ></el-input>
      <span class="psChaXun">性别 </span
      ><el-select v-model="peiSongYuanSex" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanSelectArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span class="psChaXun">年龄 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入年龄"
        v-model="peisongyuanAge"
      ></el-input>
      <span class="psChaXun">交通工具 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入交通工具"
        v-model="peiSongYuanTraffic"
      ></el-input>
      <!-- <el-select v-model="peiSongYuanTraffic" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanTrafficArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select> -->
      <span class="psChaXun">行驶证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入行驶证号"
        v-model="drivingPermit"
      ></el-input>
      <span class="psChaXun">身份证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入身份证号"
        v-model="idCard"
      ></el-input>
      <span class="psChaXun">驾驶证 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入驾驶证号"
        v-model="drivingLicense"
      ></el-input>
      <span class="psChaXun">来源 </span
      ><el-select v-model="peiSongYuanOrigin" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanOriginArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            centerDialogVisible = false;
            add();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="修改配送员"
      :visible.sync="centerPsyVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXun">姓名 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入姓名"
        v-model="peisongyuanName"
      ></el-input>
      <span class="psChaXun">电话 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="peisongyuanPhone"
      ></el-input>
      <span class="psChaXun">性别 </span
      ><el-select v-model="peiSongYuanSex" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanSelectArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span class="psChaXun">年龄 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入年龄"
        v-model="peisongyuanAge"
      ></el-input>
      <span class="psChaXun">交通工具 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入交通工具"
        v-model="peiSongYuanTraffic"
      ></el-input>
      <!-- <el-select v-model="peiSongYuanTraffic" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanTrafficArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select> -->
      <span class="psChaXun">行驶证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入行驶证号"
        v-model="drivingPermit"
      ></el-input>
      <span class="psChaXun">身份证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入身份证号"
        v-model="idCard"
      ></el-input>
      <span class="psChaXun">驾驶证 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入驾驶证号"
        v-model="drivingLicense"
      ></el-input>
      <span class="psChaXun">来源 </span
      ><el-select v-model="peiSongYuanOrigin" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanOriginArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerPsyVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            centerPsyVisible = false;
            updates();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 表显示 -->
    <el-main>
      <el-row>
        <el-button
          @click="
            centerDialogVisible = true;
            clears();
          "
          type="primary"
          plain
          >添加</el-button
        >
        <el-button @click="batch()" type="danger" plain>删除</el-button>
        <el-button @click="batchisfrez()" type="info" plain>冻结</el-button>
        <el-button @click="batchthrfrez()" type="info" plain>解冻</el-button>
      </el-row>
      <Maintable :tableData="peisongyuanArr">
        <template v-slot:tableline>
          <el-table-column prop="coname" label="姓名" width="120"> </el-table-column>
          <el-table-column prop="phone" label="电话" width="180"> </el-table-column>
          <el-table-column prop="gender" label="性别" width="80">
            <template slot-scope="scope">
              <span>{{
                scope.row.gender == 1 ? "男" : scope.row.gender == "" || 2 ? "未知" : "女"
              }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="vehicle" label="交通工具" width="140"> </el-table-column>
          <el-table-column prop="source" label="来源"> </el-table-column>
          <el-table-column prop="isFreeze" label="状态"
            ><template slot-scope="scope">{{
              scope.row.isFreeze == 0 ? "正常" : "冻结中"
            }}</template>
          </el-table-column>
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="
                  centerPsyVisible = true;
                  chakan(scope.row.phone);
                "
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="psyDelBut(scope.row.phone)"
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
    <el-footer>
      <div class="block">
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[6, 8, 10, 12]"
          :page-size="100"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>
      </div>
    </el-footer>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainpeisongyuan",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      size: 6,
      page: 1,
      total: 0,
      currentPage: 1,
      peisongyuanName: "",
      peisongyuanPhone: "",
      peisongyuanAge: "",
      peisongyuanArr: [],
      drivingLicense: "",
      drivingPermit: "",
      idCard: "",
      peiSongYuanTraffic: "面包车/电瓶车", //交通工具
      peiSongYuanOrigin: "青羊区", //来源
      peiSongYuanSex: "", //性别
      peiSongYuanZhuangTai: "", //状态
      centerDialogVisible: false,
      centerPsyVisible: false,
      peiSongYuanArr: [
        {
          PSYvalue: "0",
          PSYlabel: "正常",
        },
        {
          PSYvalue: "1",
          PSYlabel: "冻结中",
        },
      ],
      peiSongYuanSelectArr: [
        {
          value: "2",
          label: "未知",
        },
        {
          value: "1",
          label: "男",
        },
        {
          value: "0",
          label: "女",
        },
      ],
      peiSongYuanTrafficArr: "",
      peiSongYuanOriginArr: JSON.parse(window.localStorage.getItem("allzhandianArr")),
    };
  },
  methods: {
    handleSizeChange(val) {
      this.size = val;
      console.log(`每页 ${val} 条`);
      this.selects();
    },
    handleCurrentChange(val) {
      this.page = val;
      console.log(`当前页: ${val}`);
      this.selects();
    },
    //批量删除
    batch() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/courierDelete",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      this.selects();
    },
    //批量冻结
    batchisfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/freezeCourier",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //批量解冻
    batchthrfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/thawCourier",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //清空
    clears() {
      this.peisongyuanName = "";
      this.peisongyuanPhone = "";
      this.peiSongYuanSex = "";
      this.peisongyuanAge = "";
      this.drivingLicense = "";
      this.drivingPermit = "";
      this.idCard = "";
      this.peiSongYuanTraffic = "";
      this.peiSongYuanOrigin = "";
    },
    //添加
    add() {
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/addCourice",
        data: {
          age: this.peisongyuanAge,
          coname: this.peisongyuanName,
          drivingLicense: this.drivingLicense,
          drivingPermit: this.drivingPermit,
          gender: this.peiSongYuanSex,
          idCard: this.idCard,
          phone: this.peisongyuanPhone,
          source: this.peiSongYuanOrigin,
          vehicle: this.peiSongYuanTraffic,
        },
      })
        .then((response) => {
          // console.log(response);
          // this.peisongyuanArr = response.data.data;
        })
        .catch((error) => {
          console.log(error);
        });
      this.selects();
    },
    //修改信息
    updatas() {
      var phone = window.localStorage.getItem("phone");
      this.zhandianArr.forEach((element) => {
        if (element.phone == phone) {
          this.$axios({
            method: "post",
            url: "/xiaoucomeshome_war/admin/editCourice",
            data: {
              age: this.peisongyuanAge,
              coname: this.peisongyuanName,
              drivingLicense: this.drivingLicense,
              drivingPermit: this.drivingPermit,
              gender: this.peiSongYuanSex,
              idCard: this.idCard,
              phone: this.peisongyuanPhone,
              source: this.peiSongYuanOrigin,
              vehicle: this.peiSongYuanTraffic,
            },
          })
            .then((response) => {
              console.log(response);
              // this.zhandianArr = response.data.data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      });
      // this.$forceUpdate();
      this.selects();
      // console.log(id);
    },
    //删除弹出提示框
    psyDelBut(phone) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          // console.log(id);
          this.deletes(phone);
          this.selects();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //查看
    chakan(phone) {
      window.localStorage.setItem("phone", phone);
      this.peisongyuanArr.forEach((element) => {
        if (element.phone == phone) {
          this.peisongyuanAge = element.age;
          this.peisongyuanName = element.coname;
          this.drivingLicense = element.drivingLicense;
          this.drivingPermit = element.drivingPermit;
          this.peiSongYuanSex = element.gender;
          this.idCard = element.idCard;
          this.peisongyuanPhone = element.phone;
          this.peiSongYuanOrigin = element.source;
          this.peiSongYuanTraffic = element.vehicle;
        }
      });
    },
    //单个删除
    deletes(phone) {
      // console.log(phone);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/courierDeleteByPhone",
        params: { phone },
      })
        .then((res) => {
          // console.log(res);
          // this.peisongyuanArr = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/selectCourier",
        data: {
          phone: this.text,
          page: this.page,
          size: this.size,
          state: this.peiSongYuanZhuangTai,
        },
      })
        .then((response) => {
          this.total = response.data.total;
          this.peisongyuanArr = response.data.data;
          // console.log(response.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
  mounted() {
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.psChaXun {
  width: 16%;
  display: inline-block;
  margin: 5px 2%;
  text-align-last: justify;
}
.searchs {
  margin: 5px 2%;
  width: 76%;
}
.block {
  margin: 0 150px;
  float: right;
}
.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
</style>
=======
<!--
 * @Author: Xia_cc 978487464@qq.com
 * @Date: 2022-06-08 21:04:24
 * @LastEditors: Xia_cc 978487464@qq.com
 * @LastEditTime: 2022-06-10 12:59:48
 * @FilePath: \vue 小U到家\src\views\Mainpeisongyuan.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <el-container>
    <el-header>
      关键字 :
      <el-input
        class="search"
        type="text"
        placeholder="请输入内容"
        @change="selects()"
        v-model="text"
      ></el-input>
      状态 :
      <el-select
        class="search"
        @input="selects()"
        v-model="peiSongYuanZhuangTai"
        placeholder="请选择"
      >
        <el-option
          v-for="item in peiSongYuanArr"
          :key="item.PSYvalue"
          :label="item.PSYlabel"
          :value="item.PSYvalue"
          size="mini"
        >
        </el-option>
      </el-select>
    </el-header>
    <!-- 弹出框 -->
    <el-dialog
      class="psyModle"
      title="添加配送员"
      :visible.sync="centerDialogVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXun">姓名 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入姓名"
        v-model="peisongyuanName"
      ></el-input>
      <span class="psChaXun">电话 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="peisongyuanPhone"
      ></el-input>
      <span class="psChaXun">性别 </span
      ><el-select v-model="peiSongYuanSex" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanSelectArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span class="psChaXun">年龄 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入年龄"
        v-model="peisongyuanAge"
      ></el-input>
      <span class="psChaXun">交通工具 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入交通工具"
        v-model="peiSongYuanTraffic"
      ></el-input>
      <!-- <el-select v-model="peiSongYuanTraffic" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanTrafficArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select> -->
      <span class="psChaXun">行驶证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入行驶证号"
        v-model="drivingPermit"
      ></el-input>
      <span class="psChaXun">身份证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入身份证号"
        v-model="idCard"
      ></el-input>
      <span class="psChaXun">驾驶证 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入驾驶证号"
        v-model="drivingLicense"
      ></el-input>
      <span class="psChaXun">来源 </span
      ><el-select v-model="peiSongYuanOrigin" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanOriginArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            centerDialogVisible = false;
            add();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <el-dialog
      class="psyModle"
      title="修改配送员"
      :visible.sync="centerPsyVisible"
      width="37%"
      top="50px"
      center
    >
      <span class="psChaXun">姓名 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入姓名"
        v-model="peisongyuanName"
      ></el-input>
      <span class="psChaXun">电话 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入电话"
        v-model="peisongyuanPhone"
      ></el-input>
      <span class="psChaXun">性别 </span
      ><el-select v-model="peiSongYuanSex" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanSelectArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span class="psChaXun">年龄 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入年龄"
        v-model="peisongyuanAge"
      ></el-input>
      <span class="psChaXun">交通工具 </span>
      <el-input
        class="searchs"
        type="text"
        placeholder="请输入交通工具"
        v-model="peiSongYuanTraffic"
      ></el-input>
      <!-- <el-select v-model="peiSongYuanTraffic" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanTrafficArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select> -->
      <span class="psChaXun">行驶证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入行驶证号"
        v-model="drivingPermit"
      ></el-input>
      <span class="psChaXun">身份证号 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入身份证号"
        v-model="idCard"
      ></el-input>
      <span class="psChaXun">驾驶证 </span
      ><el-input
        class="searchs"
        type="text"
        placeholder="请输入驾驶证号"
        v-model="drivingLicense"
      ></el-input>
      <span class="psChaXun">来源 </span
      ><el-select v-model="peiSongYuanOrigin" class="searchs" placeholder="请选择">
        <el-option
          v-for="item in peiSongYuanOriginArr"
          :key="item.value"
          :label="item.label"
          :value="item.value"
        >
        </el-option>
      </el-select>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerPsyVisible = false">取 消</el-button>
        <el-button
          type="primary"
          @click="
            centerPsyVisible = false;
            updates();
          "
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 表显示 -->
    <el-main>
      <el-row>
        <el-button
          @click="
            centerDialogVisible = true;
            clears();
          "
          type="primary"
          plain
          >添加</el-button
        >
        <el-button @click="batch()" type="danger" plain>删除</el-button>
        <el-button @click="batchisfrez()" type="info" plain>冻结</el-button>
        <el-button @click="batchthrfrez()" type="info" plain>解冻</el-button>
      </el-row>
      <Maintable :tableData="peisongyuanArr">
        <template v-slot:tableline>
          <el-table-column prop="coname" label="姓名" width="120"> </el-table-column>
          <el-table-column prop="phone" label="电话" width="180"> </el-table-column>
          <el-table-column prop="gender" label="性别" width="80">
            <template slot-scope="scope">
              <span>{{
                scope.row.gender == 1 ? "男" : scope.row.gender == "" || 2 ? "未知" : "女"
              }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="vehicle" label="交通工具" width="140"> </el-table-column>
          <el-table-column prop="source" label="来源"> </el-table-column>
        </template>
        <template v-slot:chaozuo>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                type="primary"
                plain
                icon="el-icon-edit"
                title="编辑"
                @click="
                  centerPsyVisible = true;
                  chakan(scope.row.phone);
                "
              ></el-button>
              <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                title="删除"
                @click="psyDelBut(scope.row.phone)"
              ></el-button>
            </template>
          </el-table-column>
        </template>
      </Maintable>
    </el-main>
  </el-container>
</template>

<script>
import Maintable from "../components/main/Maintable";
export default {
  name: "Mainpeisongyuan",
  components: {
    Maintable,
  },
  computed: {},
  data() {
    return {
      text: "",
      peisongyuanName: "",
      peisongyuanPhone: "",
      peisongyuanAge: "",
      peisongyuanArr: [],
      drivingLicense: "",
      drivingPermit: "",
      idCard: "",
      peiSongYuanTraffic: "面包车/电瓶车", //交通工具
      peiSongYuanOrigin: "青羊区", //来源
      peiSongYuanSex: "", //性别
      peiSongYuanZhuangTai: "", //状态
      centerDialogVisible: false,
      centerPsyVisible: false,
      peiSongYuanArr: [
        {
          PSYvalue: "0",
          PSYlabel: "正常",
        },
        {
          PSYvalue: "1",
          PSYlabel: "冻结中",
        },
      ],
      peiSongYuanSelectArr: [
        {
          value: "2",
          label: "未知",
        },
        {
          value: "1",
          label: "男",
        },
        {
          value: "0",
          label: "女",
        },
      ],
      peiSongYuanTrafficArr: "",
      peiSongYuanOriginArr: [
        {
          value: "选项1",
          label: "青羊区",
        },
        {
          value: "选项2",
          label: "武侯区",
        },
        {
          value: "选项3",
          label: "金牛区",
        },
      ],
    };
  },
  methods: {
    //批量删除
    batch() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/courierDelete",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      this.selects();
    },
    //批量冻结
    batchisfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      // console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/freezeCourier",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //批量解冻
    batchthrfrez() {
      var Arr = JSON.parse(window.localStorage.getItem("val"));
      console.log(Arr);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/thawCourier",
        data: Arr,
      })
        .then((res) => {
          // console.log(res);
          // this.tableData = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
      // this.selects();
    },
    //清空
    clears() {
      this.peisongyuanName = "";
      this.peisongyuanPhone = "";
      this.peiSongYuanSex = "";
      this.peisongyuanAge = "";
      this.drivingLicense = "";
      this.drivingPermit = "";
      this.idCard = "";
      this.peiSongYuanTraffic = "";
      this.peiSongYuanOrigin = "";
    },
    //添加
    add() {
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/addCourice",
        data: {
          age: this.peisongyuanAge,
          coname: this.peisongyuanName,
          drivingLicense: this.drivingLicense,
          drivingPermit: this.drivingPermit,
          gender: this.peiSongYuanSex,
          idCard: this.idCard,
          phone: this.peisongyuanPhone,
          source: this.peiSongYuanOrigin,
          vehicle: this.peiSongYuanTraffic,
        },
      })
        .then((response) => {
          // console.log(response);
          // this.peisongyuanArr = response.data.data;
        })
        .catch((error) => {
          console.log(error);
        });
      this.selects();
    },
    //修改信息
    updatas() {
      var phone = window.localStorage.getItem("phone");
      this.zhandianArr.forEach((element) => {
        if (element.phone == phone) {
          this.$axios({
            method: "post",
            url: "/xiaoucomeshome_war/admin/editCourice",
            data: {
              age: this.peisongyuanAge,
              coname: this.peisongyuanName,
              drivingLicense: this.drivingLicense,
              drivingPermit: this.drivingPermit,
              gender: this.peiSongYuanSex,
              idCard: this.idCard,
              phone: this.peisongyuanPhone,
              source: this.peiSongYuanOrigin,
              vehicle: this.peiSongYuanTraffic,
            },
          })
            .then((response) => {
              console.log(response);
              // this.zhandianArr = response.data.data;
            })
            .catch((error) => {
              console.log(error);
            });
        }
      });
      // this.$forceUpdate();
      this.selects();
      // console.log(id);
    },
    //删除弹出提示框
    psyDelBut(phone) {
      this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "删除成功!",
          });
          // console.log(id);
          this.deletes(phone);
          this.selects();
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //查看
    chakan(phone) {
      window.localStorage.setItem("phone", phone);
      this.peisongyuanArr.forEach((element) => {
        if (element.phone == phone) {
          this.peisongyuanAge = element.age;
          this.peisongyuanName = element.coname;
          this.drivingLicense = element.drivingLicense;
          this.drivingPermit = element.drivingPermit;
          this.peiSongYuanSex = element.gender;
          this.idCard = element.idCard;
          this.peisongyuanPhone = element.phone;
          this.peiSongYuanOrigin = element.source;
          this.peiSongYuanTraffic = element.vehicle;
        }
      });
    },
    //单个删除
    deletes(phone) {
      // console.log(phone);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/courierDeleteByPhone",
        data: { phone },
      })
        .then((res) => {
          console.log(res);
          this.peisongyuanArr = res.data.data;
        })
        .catch((err) => {
          console.log(err);
        });
    },
    //获取页面数据
    selects() {
      // console.log(this.text);
      this.$axios({
        method: "post",
        url: "/xiaoucomeshome_war/admin/selectCourier",
        data: {
          phone: this.text,
          page: 1,
          size: 8,
          state: this.peiSongYuanZhuangTai,
        },
      })
        .then((response) => {
          this.peisongyuanArr = response.data.data;
          // console.log(response.data);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
  mounted() {
    this.selects();
  },
};
</script>

<style lang="less" scoped>
.psChaXun {
  width: 16%;
  display: inline-block;
  margin: 5px 2%;
  text-align-last: justify;
}
.searchs {
  margin: 5px 2%;
  width: 76%;
}
.search {
  margin: 10px 40px 0 20px;
  width: 20%;
}
</style>
>>>>>>> ae27e4fe2d4f939d0b0ee2bfa506b9e3269c53cb
